package springboot.p2.scope;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @description: 测试类
 * @author: lzp
 * @createTime: 2021-08-27 00:10
 **/
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScopeScanConfig.class);
        DemoSingletonService bean1 = context.getBean(DemoSingletonService.class);
        DemoSingletonService bean2 = context.getBean(DemoSingletonService.class);
        System.out.println(bean1 == bean2); // true

        DemoPrototypeService bean3 = context.getBean(DemoPrototypeService.class);
        DemoPrototypeService bean4 = context.getBean(DemoPrototypeService.class);
        System.out.println(bean3 == bean4); // false
    }
}
